package com.ncs.cns.business.util;

import java.text.ParseException;

import android.os.Bundle;

import com.ncs.cns.business.constants.BundleConstants;
import com.ncs.cns.business.to.Event;

public class BundleUtil {

	public static Bundle buildEventBundle(Event event){
		Bundle bundle = new Bundle();
		if (event!=null) {
			bundle.putString(BundleConstants.BUNDLE_EVENT_DETAIL,event.getEventContent());
			bundle.putString(BundleConstants.BUNDLE_EVENT_SUBJECT,event.getEventSubject());
			if(event.getCreatedTime()!=null){
				long time = 0;
				try {
					time = DateUtil.parse(event.getCreatedTime(), DateUtil.yyyy_MM_dd_HH_mm_ss).getTime();
					
				} catch (ParseException e) {
					e.printStackTrace();
				}
				bundle.putLong(BundleConstants.BUNDLE_EVENT_CREATE_MINUTE,time);
			}
			bundle.putInt(BundleConstants.BUNDLE_EVENT_ID, event.getEventId());
			bundle.putString(BundleConstants.BUNDLE_EVENT_PARTY_DESC, event.getEventPartyDescription());
			bundle.putInt(BundleConstants.BUNDLE_EVENT_WATCHED, event.getEventNumberWatched());
			bundle.putString(BundleConstants.BUNDLE_EVENT_CREATE_BY, event.getEventPartyDescription());
		}
		return bundle;
	}
}
